package com.service.activiti;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.common.StringUtils;
import com.dao.sys.SysManageMapper;

/**
 * 提供ue-method表达式通用方法
 * 
 * @author Administrator
 *
 */
public class ActivitiService {

	@Autowired
	SysManageMapper SysManageMapper;

	public String getUserNameByUserId(String userId) {
		return "activiti" + userId;
	}

	/**
	 * 获取用户直属上级
	 * 
	 * @param userId
	 * @return
	 */
	public String getUserChief(String userId) {
		String level = "level";

		return level;
	}

	/**
	 * 获取此部门内所属角色内人员，逗号分隔
	 * 
	 * @param userId
	 * @return
	 */
	public String getCandidateUsers(String deptId, String roleName) {
		String users = "";
		List<HashMap<String, Object>> list = SysManageMapper.GetCandidateUsersFromDept(deptId, roleName);
		for (HashMap<String, Object> map : list) {
			users += map.get("userid") + ",";
		}
		users = StringUtils.sideTrim(users, ",");
		return users;
	}
}
